//
//  HYMainMoviePlagerViewController.m
//  KaiJing
//
//  Created by lanou on 16/1/13.
//  Copyright © 2016年 HuangZuCui. All rights reserved.
//

#import "HYMainMoviePlagerViewController.h"
#import <AVKit/AVKit.h>
#import <AVFoundation/AVFoundation.h>
@interface HYMainMoviePlagerViewController ()

@property (nonatomic, strong) AVPlayerViewController *avControl;


@end

@implementation HYMainMoviePlagerViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _avControl = [[AVPlayerViewController alloc] init];
    _avControl.view.frame = CGRectMake(0, 0, kScreenWidth, kScreenHeight);
    [self.view addSubview:_avControl.view];
    
    
    _avControl.player = [[AVPlayer alloc] initWithURL:[NSURL URLWithString:_movie]];
    [_avControl.player play];

}






- (void)setPlayerModel:(HYYingKuMainModel *)playerModel
{
    self.tabBarController.tabBar.hidden = YES;
    _avControl = [[AVPlayerViewController alloc] init];
    _avControl.view.frame = CGRectMake(0, 0, kScreenWidth, kScreenHeight);
    [self.view addSubview:_avControl.view];

   _movie = [NSString stringWithFormat:@"%@",playerModel.moviedata[@"trailerurl"]];
    _avControl.player = [[AVPlayer alloc] initWithURL:[NSURL URLWithString:_movie]];
    [_avControl.player play];
   
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
